/*
 * FileName：AccountFans.java 
 * <p>
 * Copyright (c) 2017-2020 <a href="https://www.smartwx.info">hermit(1154808491@qq.com)</a>.
 * <p>
 * Licensed under the GNU General Public License, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.gnu.org/licenses/gpl-3.0.html
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package com.smart.wx.wxcms.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.smart.common.annotation.WxAccount;
import com.smart.common.page.Page;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;

/**
 *
 * @author hermit
 * @version 2.0
 * @date 2018-04-17 10:54:58
 */
@Data
@WxAccount
public class AccountFans extends Page implements Serializable{
    private Long id;
    
    private String openId;// openId，每个用户都是唯一的
    
    private Integer subscribeStatus;// 订阅状态
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date subscribeTime;// 订阅时间
    
    private byte[] nickname;// 昵称,二进制保存emoji表情
    
    private String nicknameStr;// 昵称显示
    
    private String wxid;// 微信号
    
    private Integer gender;// 性别 0-女；1-男；2-未知
    
    private String language;// 语言
    
    private String country;// 国家
    
    private String province;// 省
    
    private String city;// 城市
    
    private String headimgurl;// 头像
    
    private String remark;// 备注
    
    private Integer status;// 用户状态 1-可用；0-不可用
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date createTime;// 创建时间
    
    public String getNicknameStr() {
        if (this.getNickname() != null) {
            try {
                this.nicknameStr = new String(this.getNickname(), "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        return nicknameStr;
    }
    private String account;
}
